#include "DataCollector.h"

#include <string.h> //memcpy

namespace EEGSignalProcessor
{
	DataCollector::DataCollector(void)
	{
		_dataBuffer = new double[TIME_BUFFER_SIZE];
		_currentIndex = 0;
	}


	DataCollector::~DataCollector(void)
	{
		delete[] _dataBuffer;
	}

	double* DataCollector::GetData()
	{
		double* ToReturn = new double[TIME_BUFFER_SIZE];
		double* midPoint = _dataBuffer + _currentIndex;
		memcpy(ToReturn, midPoint, (TIME_BUFFER_SIZE - _currentIndex) * sizeof(double));
		memcpy(ToReturn + _currentIndex, _dataBuffer, _currentIndex);
		return ToReturn;
	}
}